#
import time


def test():
    import serial_test
    serial_test.check_serial()

    print('检查EEPROM功能')
    import eeprom

    print('检查RTC功能')
    import rtc

    from mcp23017 import MCP23017
    MCP23017.set_out(0x20, MCP23017.ALL, MCP23017.LOW)
    MCP23017.set_dir(0x20, MCP23017.ALL, MCP23017.OUT)

    for i in range(16):
        MCP23017.set_out(0x20, i, MCP23017.HIGH)
        print('输出【%d】已打开。' % int(i+1))
        time.sleep(2)
        MCP23017.set_out(0x20, i, MCP23017.LOW)
        print('输出【%d】已关闭。' % int(i+1))
        time.sleep(2)

    print('检查输入信号')
    import input_test
    input_test.init()

    input("Press Enter to continue...")


if __name__ == '__main__':
    test()
